import { param } from "@/utils";
import http from "@/utils/request";

/**
 *  获取权限菜单列表api
 *
 * @param {*} params
 * @returns
 */
export const getMenuListApi = async (params) => {
  return await http.get("/api/permission/list", params);
};

/**
 *  获取上级菜单
 * @param {*} params
 * @returns
 */
export const getParentMenuListApi = async (params) => {
  return await http.get("/api/permission/parent/list", params);
};

/**
 *  添加菜单
 * @param {*} params
 * @returns
 */
export const addMenuApi = async (params) => {
  return await http.post("/api/permission/add", params);
};

/**
 *   菜单修改
 * @param {*} params
 * @returns
 */
export const editMenuApi = async (params) => {
  return await http.put("/api/permission/update", params);
};

/**
 *  检查菜单下是否有子菜单
 * @param {*} params
 */
export const checkPermissionApi = async (params) => {
  return await http.getRestApi("/api/permission/check", params);
};

/**\
 *  删除菜单
 */
export const deletePermissionByIdApi = async (params) => {
  return await http.delete("/api/permission/delete", params);
};
